#ifndef TUPLETS_H_
#define TUPLETS_H_
#include "Multitree.h"
//I do not know, if tuplet is a real word.
/* Tuplets are structures, that hold coefficient (number)
 * and the tree. They are used to add or multiply some parts of the tree.
 * Example: When adding, for 2*cos(x)*sin(x) the coefficient is 2 and the rest is cos(x)*sin(x).
 * For tan(y)^4, the coefficient when adding is 1 and rest is tan(y)^4. However when
 * multiplying, the coefficient is 4 and rest is tan(y).
 * if we are to add 2*cos(x)*sin(x)+3*cos(x)*sin(x), we create tuplets
 * then compare rests and if they are equal, we add coefficients and we can destroy one tuplet.
 * (rests are same: cos(x)*sin(x). Add coeff.: 2+3 = 5. Result: 5*sin(x)*cos(x).
 * default coefficient is 1. If coefficient is 0, tuplet can be destroyed.
 * And it is linked list!
 */

namespace SymCe{
	struct Tuplet{
		Number coefficient;
		Multitree * tree;
		Tuplet * next;
	};
	Tuplet * childs_to_tuplets(OperatorType oper, ListOfChilds * childs);
	Tuplet * add_tuplets(Tuplet * tuplet);
	void delete_tuplets(Tuplet * tuplets);
	Tuplet * remove_null_tuplets(Tuplet * tuplet);
	ListOfChilds * tuplets_to_childs(OperatorType oper, Tuplet * tuplet);
}


#endif /*TUPLETS_H_*/

